<template>
    <div class="input-label" ref="inputLabel">
        <label>
            <input class="inp"
                   v-model="value"
                   :type="type"
                   :placeholder="placeholder"
                   @input="inputs"
                   @focus="change"
                   @blur="blur">
        </label>
    </div>
</template>

<script>
    export default {
        name: "Input",
        props: {
            type: {
                default: 'text',
                type: String
            },
            placeholder: {
                default: "请输入",
                type: String
            },
        },

        data() {
            return {
                value: '',
            }
        },
        mounted() {
        },
        methods: {
            change() {
                this.$refs.inputLabel.style = "border-bottom: 1px solid #FE792A"
            },
            blur() {
                this.$refs.inputLabel.style = "border-bottom: 1px solid #eee"
            },
            inputs() {
                this.$emit('input', this.value)
            }
        },
    }
</script>

<style scoped lang="scss">
    .input-label {
        border-bottom: .6px solid #eee;
        width: 80%;
        margin: 0 auto;


        .inp {
            width: 100%;
            border: none;
            height: 60px;
            margin: 20px 0;
            font-size: 4vw;
            caret-color: #616161;

            &::placeholder {
                color: rgba(153, 153, 153, 0.87);
            }
        }
    }
</style>